package com.shiyi.sqlSession;

import com.shiyi.config.XMLConfigBuilder;
import com.shiyi.pojo.Configration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

/**
 * @Descrption
 * @Author: 十一
 * @Date: 2020-11-08 22:26
 * @Version V4.6
 **/
public class SqlSessionFactoryBuilder {

    public static SqlSessionFactory build(InputStream in) throws PropertyVetoException, DocumentException {
        // 解析SqlMapConfig
        Configration configration = new XMLConfigBuilder().parse(in);

        DefaultSqlSessionFactory defaultSqlSessionFactory = new DefaultSqlSessionFactory(configration);
        return defaultSqlSessionFactory;
    }
}
